#include "EnemyManager.h"

#include "LevelManager.h"
#include "Singleton.h"

bool EnemyManager::initialised = false;
EnemyManager EnemyManager::instance = EnemyManager();

void EnemyManager::initialise(const boost_path& fileName)
{
    BEGIN_INITIALISATION("EnemyManager");

    // load entries from file
    //instance.readFile(fileName);

    END_INITIALISATION("EnemyManager");
}

EnemyManager& EnemyManager::get()
{
    GET_INSTANCE("EnemyManager");
}

void EnemyManager::cleanUp()
{
    BEGIN_CLEAN_UP("EnemyManager");

    //

    END_CLEAN_UP("EnemyManager");
}

EnemyManager::EnemyManager()
{
}

EnemyManager::~EnemyManager()
{
}

void EnemyManager::draw(sf::RenderWindow& window)
{
    LevelPtr currentLevel = LevelManager::get().getCurrentLevel();
    std::vector<EnemyPtr>& enemies = currentLevel->getEnemies();
	for(size_t i = 0; i < enemies.size(); i++)
    {
        window.Draw(*enemies[i]->getSprite());
	}
}

void EnemyManager::update(float delta)
{
    LevelPtr currentLevel = LevelManager::get().getCurrentLevel();
    std::vector<EnemyPtr>& enemies = currentLevel->getEnemies();
	for(std::vector<EnemyPtr>::iterator it = enemies.begin();
    it != enemies.end(); ++it)
    {
        (*it)->getSprite()->update(delta);
	}
}